package date;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

public class Demo2 {

	public static void main(String[] args) {
		System.out.println((long)(3.1415926/1000+0.5)/1000.0);
		String filepath;
		System.out.println("请输入要查看的文件：");
		Scanner in=new Scanner(System.in);
		filepath=in.nextLine();
	    File f=new File(filepath);
	    long lastModi = f.lastModified();
	    Calendar c=Calendar.getInstance();
	    c.setTimeInMillis(lastModi);
	    int y=c.get(Calendar.YEAR);
	    int m=c.get(Calendar.MONTH);
	    int d=c.get(Calendar.DAY_OF_MONTH);
	    int h=c.get(Calendar.HOUR);
	    int mi=c.get(Calendar.MINUTE);
	    int s=c.get(Calendar.SECOND);
	    System.out.println(y+"年"+m+"月"+d+"日"+h+"："+mi+"："+s);
	    Date d1=new Date(lastModi);
	    SimpleDateFormat sdf=new  SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
	    System.out.println("最后修改时间："+sdf.format(d1)); 
	    //String length=f.length()/1024>1024?(String) (f.length()/1024/1024+"MB"):f.length()/1024+"KB";
	    long length=f.length()/8/1024/1024;
	    System.out.println("文件大小："+length);
	    String hi=f.isHidden()?"隐藏":"不隐藏";
	    System.out.println("是隐藏文件吗？"+hi);
	   	String cw=f.canWrite()?"只读":"读写";
	    System.out.println("文件是读写吗？"+cw);
	    String name=f.getName();
	    System.out.println("文件名为："+name);
				
	}

}
